Stored Procedures [dbo].[amsp_CMSetMembersOnlyContent]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@InNavMenuIDnumeric(18,0)9
@InMembersOnlyFlagchar1
@InContactIDnumeric(18,0)9
Permissions
TypeActionOwning Principal
GrantExecuteIMIS
SQL Script
-- =============================================
-- This stored procedure sets Member's Only Content for simple websites.
-- For simple websites, Member's only flag is set on Nav_Menu table.
-- This sp reflects the change in Nav_Menu table to content records.
--
-- Modifications
-- 10/13/2003    E.Tatsui    Created
-- =============================================
CREATE PROCEDURE amsp_CMSetMembersOnlyContent
  @InNavMenuID numeric,
  @InMembersOnlyFlag char(1),
  @InContactID numeric
AS
BEGIN
  DECLARE
    @ContentID numeric,
    @OutContentID numeric

  -- All the outstanding content for this nav item needs to
  DECLARE c_Content CURSOR FOR
  SELECT ContentID
    FROM vCurrent_Content
   WHERE NavMenuID = @InNavMenuID
  
  OPEN c_Content
  FETCH NEXT FROM c_Content
   INTO @ContentID

  WHILE @@FETCH_STATUS = 0 BEGIN
    -- In order to change Member's Only Flag, we need to make working versions of Content record.
    EXEC amsp_CMGetWorkingContentID @ContentID, @InContactID, @OutContentID OUTPUT
    -- Change the status to approved since this is simple site.
    EXEC amsp_CMChangeStatus @OutContentID, 'A', @InContactID
  
    SET @ContentID = @OutContentID
  
    -- Set Member's Only Flag.
    UPDATE Content
       SET MembersOnlyFlag = @InMembersOnlyFlag
     WHERE ContentID = @ContentID

    DELETE FROM Content_Security_Group
     WHERE ContentID = @ContentID

    -- If this is member's only, copy security group.
    IF @InMembersOnlyFlag = 'Y'
      INSERT INTO Content_Security_Group
                  (ContentID,
                   SecurityGroupCode)
      SELECT @ContentID,
             SecurityGroupCode
        FROM Nav_Menu_Security_Group
       WHERE NavMenuID = @InNavMenuID
    
    FETCH NEXT FROM c_Content
     INTO @ContentID
  END
  CLOSE c_Content
  DEALLOCATE c_Content
END

GO
GRANT EXECUTE ON  [dbo].[amsp_CMSetMembersOnlyContent] TO [IMIS]
GO
Uses